<?php namespace Summer\Location;

use Backend;
use System\Classes\PluginBase;
use Event;

class Plugin extends PluginBase
{
    public function registerComponents()
    {
    }

    public function registerSettings()
    {
        return [
            'location' => [
                'label'       => 'summer.location::lang.location.menu_label',
                'description' => 'summer.location::lang.location.menu_description',
                'category'    => 'HJD',
                'icon'        => 'icon-building-o',
                'url'         => Backend::url('summer/location/province'),
                'order'       => 500,
                'permissions' => ['summer.location.access_settings'],
                'keywords'    => 'province, city, county',
            ]
        ];
    }

    public function boot()
    {
        Event::listen('backend.menu.extendItems', function($manager) {

            $manager->addSideMenuItems('RainLab.User', 'user', [
                'side-menu-item-user_address' => [
                    'label' => '收货地址',
                    'url' => Backend::url('summer/location/useraddress'),
                    'icon' => 'icon-building-o',
                ]
            ]);

        });
    }
}
